package com.lh.ssm.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lh.ssm.domain.Product;
import com.lh.ssm.mapper.ProductMapper;
import com.lh.ssm.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ProductMapper productMapper;
    @Override
    public PageInfo<Product> findProducts(int id, int currentpage) {
        PageHelper.startPage(currentpage,4);
        List list = productMapper.selectAllProducts(id);
        return new PageInfo<>(list);
    }

    @Override
    public Product findProductById(String pid) {
        return productMapper.findProductById(pid);
    }
}
